<?php

/**
 * Child form.
 *
 * @package    sf_sandbox
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfPropelFormTemplate.php 10377 2008-07-21 07:10:32Z dwhittle $
 */
class ChildForm extends BaseChildForm
{
  public function configure()
  {
  	
  	    $this->setWidgets(array(
      'id'         => new sfWidgetFormInputHidden(),
      'user_id'    => new sfWidgetFormInputHidden( array (), array ('value' => sfContext::getInstance()->getUser()->getAttribute( 'user_id', null, 'sfGuardSecurityUser' ))),
      'gender'     => new sfWidgetFormChoice(array('choices' => array('m'=>__('Сын'), 'w'=>__('Дочь')))),
      'photo_path' => new sfWidgetFormInputFile(),
      'name'       => new sfWidgetFormInput(),
      'birthday'   => new sfWidgetFormI18nDate(array('culture' =>sfContext::getInstance()->getUser()->getCulture(),'years' => sfContext::getInstance()->getUser()->getYearsChild())),
    ));
    
         $this->validatorSchema ['photo_path'] = new sfValidatorFile ( array ('required' => false, 
		'path' => sfConfig::get ( 'sf_web_dir' ) . '/uploads/users/child', 
		'mime_types' => 'web_images', 'max_size' => 500000, // 360 kB
        'validated_file_class' => 'sfUserChildValidatedFile' ) );
         
        // $this->validatorSchema ['birthday'] = new sfValidatorDate();

         // label
		$this->widgetSchema->setLabels(
    		array(
		      'birthday'  => __('Birthday').'',
		      'gender'    => __('Gender').' <span class="red">*</span>',
		    )
    	);          
         
    // helps
    $this->widgetSchema->setHelps(array(
      'photo_path'  => __('Максимальный размер файла - 500 Kb'),
    ));    
         
    
     $this->widgetSchema->setNameFormat('child[%s]');
  	
  }
}
